package com.ruoyi.web.controller.byhealth;


import com.ruoyi.by.health.domain.entity.ByhealthPrize;
import com.ruoyi.by.health.service.IByhealthPrizeService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 员工信息管理
 *
 * @author zhangjq
 */
@Slf4j
@Api(value = "奖品管理", tags = "奖品管理")
@RestController
@RequestMapping("/byhealth/prize")
public class ByhealthPrizeController extends BaseController {
    @Autowired
    public IByhealthPrizeService prizeService;

    /**
     * 获取奖品列表
     */
    @ApiOperation("奖品列表")
    @GetMapping("/list")
    public TableDataInfo prize(ByhealthPrize prize) {
        startPage();
        List<ByhealthPrize> list = prizeService.selectPrizeList(prize);
        return getDataTable(list);
    }

    @ApiOperation("删除奖品")
    @DeleteMapping("/delete/{id}")
    public AjaxResult delete(@PathVariable Long id) {
        return AjaxResult.success(prizeService.deletePrize(id));
    }

    @ApiOperation("增加奖品")
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ByhealthPrize prize) {
        return AjaxResult.success(prizeService.insertPrize(prize));
    }

    @ApiOperation("修改奖品")
    @PutMapping("/update")
    public AjaxResult update(@RequestBody ByhealthPrize prize) {
        return AjaxResult.success(prizeService.updatePrize(prize));
    }


}
